<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}" lang="${lang}">
    <head>
        <title>#{get 'title' /}</title>		
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <link rel="stylesheet" type="text/css" media="screen" href="@{'/public/stylesheets/crud.css'}" />
        <link type="text/css" href="@{'/public/stylesheets/ui-lightness/jquery-ui-1.8.4.custom.css'}" rel="stylesheet" />
        <script src="@{'/public/javascripts/jquery-1.6.4.min.js'}" type="text/javascript" charset="utf-8"></script>
        <script src="@{'/public/javascripts/jquery-ui-1.8.4.custom.min.js'}" type="text/javascript" charset="utf-8"></script>
        <script src="@{'/public/javascripts/jquery-ui-timepicker-addon-0.5-custom.min.js'}" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">
			var addListAction = #{jsAction @addListElement(':id', ':field') /}	
		    var addListElement = function(id, field, elt) {
		        $(elt).load( addListAction({id: id, field: field}) )
		    }

		    var delListAction = #{jsAction @deleteListElement(':id', ':field', ':idx') /}	
		    var delListElement = function(id, field, idx, elt) {
		        $(elt).load( delListAction({id: id, field: field, idx: idx}) )
		    }

		    var addMapAction = #{jsAction @addMapElement(':id', ':field', ':mkey') /}	
		    var addMapElement = function(id, field, mkey, elt) {
		        $(elt).load( addMapAction({id: id, field: field, mkey: mkey}) )
		    }

		    var delMapAction = #{jsAction @deleteMapElement(':id', ':field', ':mkey') /}	
		    var delMapElement = function(id, field, mkey, elt) {
		        $(elt).load( delMapAction({id: id, field: field, mkey: mkey}) )
		    }
		</script> 
	</head>
	<body id="crud">
		
		<div id="crudHeader">
			<h1><a href="@{CRUD.index()}">&{'crud.title'}</a></h1>
		</div>
		
		#{if request.actionMethod != 'index'}
			<div id="crudBreadcrumb">
				#{crud.navigation /}
			</div>
		#{/if}

		#{if flash.success}
			<div class="crudFlash flashSuccess">
				${flash.success}
			</div>
		#{/if}
		#{if flash.error || error}
			<div class="crudFlash flashError">
				${error ?: flash.error}
			</div>
		#{/if}
		
		<div id="crudContent">
			#{doLayout /}
		</div>
		
		<div id="crudFooter">
			Generated by the Play! CRUD module. <a href="http://www.playframework.org/manual/contents/crud">Learn how to customize it !</a>
		</div>
		
	</body>
</html>
